<?
require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();

//if (get_user_class() < UC_UPLOADER)
//	alert("Sorry...", "You are not authorized to upload torrents.  (See <a href=\"faq.php#up\">Uploading</a> in the FAQ.)");

if (strlen($CURUSER['passkey']) != 32) 
  {
  $CURUSER['passkey'] = md5($CURUSER['username'].get_date_time().$CURUSER['passhash']);
  query("UPDATE users SET passkey='$CURUSER[passkey]' WHERE id=$CURUSER[id]");
  }

$announce = $announce_urls[0] . "?passkey=" . $CURUSER['passkey'];

stdhead("Upload");
?>

<form enctype="multipart/form-data" action="takeupload.php" method="post">
<p>Your personal announce url is <b><?=$announce?></b></p>
<table border="1" cellspacing="0" cellpadding="10">

<?
tr("Torrent file", "<input type=\"file\" name=\"file\" size=\"80\" />", 1);
tr("Torrent name", "<input type=\"text\" name=\"name\" size=\"80\" /><br />(Taken from filename if not specified. <b>Please use descriptive names.</b>)", 1);
tr("NFO file", "<input type=\"file\" name=\"nfo\" size=\"80\" /><br />(<b>Optional.</b> Can only be viewed by power users. Will be auto-inserted into description.)", 1);
tr("Description", "<textarea name=\"descr\" rows=\"10\" cols=\"80\"></textarea><br />(HTML is not allowed, but <a href=tags.php target='_blank'>tags</a> and <a href=smilies.php target='_blank'>smilies</a> are allowed. <a href=nforipper.php target='_blank'>Click here</a> to manually rip an nfo.)", 1);

$s = "<select name=\"type\">\n<option value=\"0\">(choose one)</option>\n";

$cats = genrelist();
foreach ($cats as $row)
	$s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";

$s .= "</select>\n";
tr("Type", $s, 1);
?>

<tr><td align="center" colspan="2"><input type="submit" class=btn value="Do it!" /></td></tr>

</table>
</form>

<?
stdfoot();
?>